package org.kjtc.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.kjtc.entity.LineInfo;
import org.kjtc.entity.Page;
import org.kjtc.entity.UserAccessInfo;
import org.kjtc.entity.UserInfo;
import org.springframework.stereotype.Service;

@Service("userInfoService")
public class UserInfoService extends BaseService {

	@SuppressWarnings("unchecked")
	public List<UserInfo> getUserInfoPage(UserInfo info, Page page) throws Exception{
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("info", info);
		map.put("page", page);
		return (List<UserInfo>)this.getDaoSupport().findForList("T_UserInfo.getUserInfoPage", map);
	}
	@SuppressWarnings("unchecked")
	public List<UserInfo> getUserInfo(UserInfo userInfo) throws Exception{
		return (List<UserInfo>)this.getDaoSupport().findForList("T_UserInfo.getUserInfo", userInfo);
	}
	@SuppressWarnings("unchecked")
	public List<UserInfo> getUserInfoPerson(UserInfo userInfo) throws Exception{
		return (List<UserInfo>)this.getDaoSupport().findForList("T_UserInfo.getUserInfoPerson", userInfo);
	}
	@SuppressWarnings("unchecked")
	public List<UserInfo> getTeamUserInfo(LineInfo lineInfo) throws Exception{
		return (List<UserInfo>)this.getDaoSupport().findForList("T_UserInfo.getTeamUserInfo", lineInfo);
	}
	@SuppressWarnings("unchecked")
	public List<UserInfo> getUserTeam(UserInfo userInfo) throws Exception{
		return (List<UserInfo>)this.getDaoSupport().findForList("T_UserInfo.getUserTeam", userInfo);
	}
	public int saveUserAccessInfo(UserAccessInfo userAccessInfo) throws Exception{
		return (int)this.getDaoSupport().save("T_UserInfo.saveUserAccessInfo", userAccessInfo);
	}
	public int updateUserAccessInfo(UserAccessInfo userAccessInfo) throws Exception{
		return (int)this.getDaoSupport().update("T_UserInfo.updateUserAccessInfo", userAccessInfo);
	}
	public int saveUserTeam(List<UserInfo> userInfoList) throws Exception{
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("userInfoList", userInfoList);
		return (int)this.getDaoSupport().save("T_UserInfo.saveUserTeam", map);
	}
	public int deleteUserTeam(UserInfo userInfo) throws Exception{
		return (int)this.getDaoSupport().delete("T_UserInfo.deleteUserTeam", userInfo);
	}
}
